import {request} from '@pkg/request/src';

export enum Api {
  page = '/front/user/page',
  get = '/front/user/get',
  update = '/front/user/update',
  save = '/front/user/add',
  companyList = '/company/list',
  companyGet = '/company/get',
  remove = '/front/user/remove',
  setUserStatus = '/front/user/setStatus',
  unBindOpenId = '/userExt/unBindOpenId',
  resetPwd = '/front/user/resetPwd',
  updateBusNum = '/user/changeBusNum',
  importNewUserExcel = '/userExt/importNewUserExcel',
}

export const getUserInfo = (params) =>
    request.get(
        {
          url: Api.get,
          params: params,
        },
        {errorMessageMode: 'message', successMessageMode: 'none'},
    );

export const setUserStatus = (userId: number) =>
    request.post({
      url: Api.setUserStatus,
      params: {userId: userId},
    });

export const unBindOpenId = (userId: number) =>
    request.post({
      url: Api.unBindOpenId,
      params: {userId: userId},
    });
export const resetPwd = (userId: number) =>
    request.post({
      url: Api.resetPwd,
      params: {userId: userId, password: '123456789'},
    });

export const userUpdate = (params) =>
    request.post(
        {
          url: Api.update,
          params: params,
        },
        {errorMessageMode: 'message'},
    );

export const updateBusNum = (params) =>
    request.post(
        {
          url: Api.updateBusNum,
          params: params,
        },
        {errorMessageMode: 'message'},
    );
/**
 * 查询企业情
 * @param params
 */
export const getCompanyInfo = (params) => {
  return request.get({url: Api.companyGet, params});
};
